package org.luxor.commons.core.config.properties;

import org.luxor.commons.core.utils.StrKit;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * XSS 过滤器配置
 *
 * @author Mr.yan @date 2020/2/12
 */
@ConfigurationProperties(prefix = XssFilterProperties.PREFIX)
public class XssFilterProperties {
    public static final String PREFIX = "spring.xss";
    private static final String URL_PATTERNS_DEF = "/*";

    /**
     * 是否启用
     */
    private boolean enabled;

    /**
     * 排除拦截的接口
     */
    private String excludedPages;
    /**
     * 拦截的url，默认为全部
     */
    private String urlPatterns;

    public XssFilterProperties() {
        this.enabled = false;
        this.excludedPages = StrKit.EMPTY;
        this.urlPatterns = URL_PATTERNS_DEF;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public String getExcludedPages() {
        return excludedPages;
    }

    public void setExcludedPages(String excludedPages) {
        this.excludedPages = excludedPages;
    }

    public String getUrlPatterns() {
        return urlPatterns;
    }

    public void setUrlPatterns(String urlPatterns) {
        this.urlPatterns = urlPatterns;
    }

}
